#pragma once

#include "Relationship.h"

#include "Element.h"

namespace uml {

void Relationship::fromJson(const QJsonObject& json, QStringList& errorList) {
    if (json.isEmpty()) {
        return;
    }

    PartialElement::fromJson(json, errorList);
    JsonSerializable::fromJsonArray(relatedElements_, "relatedElements", json, errorList);
}

void Relationship::toJson(QJsonObject& json) {
    PartialElement::toJson(json);
    JsonSerializable::toJsonArray(relatedElements_, "relatedElements", json);
}

/// <summary>
/// relatedElements getter
/// Specifies the elements related by the Relationship.
/// </summary>
vector<shared_ptr<Element>>& Relationship::relatedElements() {
    return relatedElements_;
}

} // namespace uml
